home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Technotools
/
Technotools (Chestnut CD-ROM)(1993).ISO
/
lantools
/
blueprnt
/
bpdebug.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1990-01-03
|
3KB
|
106 lines
program set_time_from_server;
(*************************************************************
* Set Time using Time on Specifed Server *
* by Craig Chaiken (BPTIME.PAS, BPTIME.EXE) * *
* October 3, 1989 *
* *
* Function: *
* This program reads the number of ticks since midnight, *
* a 32 bit number at location 0000:046C, from the *
* server, and set this client to match. *
* *
* Command Format: *
* BPTIME /socket_number *
*************************************************************)
uses dos;
{$I bppascal.inc}
var
temp:integer;i:word;
high_nibble,low_nibble:byte;
command:string;
function hexbyte(decimal:byte):string;
var s:string;
begin
s:='';
high_nibble:=(decimal shr 4) and $f;
low_nibble:=(decimal and $f);
if high_nibble > 9 then high_nibble:=high_nibble+7;
if low_nibble > 9 then low_nibble:=low_nibble+7;
s:=s+chr(ord('0')+high_nibble);
s:=s+chr(ord('0')+low_nibble);
hexbyte:=s;
end;
function hexword(decimal:word):string;
var s:string;
begin
s:=hexbyte(hi(decimal))+hexbyte(lo(decimal));
hexword:=s
end;
function get_command:string;
var s:string;
begin
write ('-');
readln(s);
s[1]:=upcase(s[1]);
for i:=2 to length(s) do
begin
s[i]:=upcase(s[i]);
if s[i]>'9' then s[i]:=chr(ord(s[i])-7);
s[i]:=chr(ord(s[i])-48)
end;
get_command:=s
end;
procedure build_packet;
var j:integer;
begin
packet_length:=1;
j:=2;
while j<length(command) do
begin
packet_buffer[packet_length]:=ord(command[j]) shl 4
+ord(command[j+1]);
j:=j+2;
inc(packet_length)
end;
packet_buffer[0]:=ord(command[1]) or byte($20);
end;
begin
socket_number:=get_opt(1);
command:='Start';
while command[1]<>'Q' do
begin
command:=get_command;
case command[1] of
'R','I':
begin
build_packet;
put_packet(socket_number);
packet_length:=get_packet(socket_number);
for i:=1 to packet_length-1 do
write(hexbyte(packet_buffer[i]));
writeln;
for i:=1 to packet_length-1 do
if packet_buffer[i]>31 then
write(chr(packet_buffer[i]))
else
write('.');;
writeln;
end;
'W','O','F','M','E':
begin
build_packet;
put_packet(socket_number);
end;
'Q':writeln('Quit');
else writeln('Invalid Debugger Command!');
end;
end;
end.